package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppUserAuthentication;
import com.ep.modules.app.service.AppUserAuthenticationService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/user_authentication")
public class AppUserAuthenticationController {
    @Autowired
    private AppUserAuthenticationService appUserAuthenticationService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appUserAuthenticationService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppUserAuthentication appuserauthentication = appUserAuthenticationService.getById(id);
        return R.ok().put("appuserauthentication", appuserauthentication);
    }

    @SysLog("保存AppUserAuthentication")
    @PostMapping("/save")
    public R save(@RequestBody AppUserAuthentication appuserauthentication) {
        ValidatorUtils.validateEntity(appuserauthentication);
        appUserAuthenticationService.save(appuserauthentication);
        return R.ok();
    }

    @SysLog("修改AppUserAuthentication")
    @PostMapping("/update")
    public R update(@RequestBody AppUserAuthentication appuserauthentication) {
        ValidatorUtils.validateEntity(appuserauthentication);
        appUserAuthenticationService.update(appuserauthentication);
        return R.ok();
    }

    @SysLog("删除AppUserAuthentication")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appUserAuthenticationService.deleteBatch(ids);
        return R.ok();
    }
}